
<%@page import="com.bill.common.user.dto.RegUserBasicDTO"%>
<%@page import="com.bill.common.user.service.IRegisterUserService"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="../language.jsp" %>

<%
if(session.getAttribute("password2")==null){
	response.sendRedirect( "login2.jsp?pageUrl=user/changeMobile.jsp");
	return;
}

ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
IRegisterUserService registerUserService = (IRegisterUserService)ac.getBean("registerUserService");
RegUserBasicDTO rubDTO = registerUserService.findRegUserBasicInfo((String)session.getAttribute("loginName"));
request.setAttribute("rubDTO",rubDTO);

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title><fmt:message key="i18n.title"/> </title>
	<meta name="apple-mobile-web-app-capable" content="yes" />
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1" />
	
	<link rel="shortcut icon" href="../index/favicon.png" />
	
	<!-- bootstrap -->
    <link href="css/bootstrap/bootstrap.css" rel="stylesheet" />
    <link href="css/bootstrap/bootstrap-responsive.css" rel="stylesheet" />
    <link href="css/bootstrap/bootstrap-overrides.css" type="text/css" rel="stylesheet" />

    <!-- global styles -->
    <link rel="stylesheet" type="text/css" href="css/elements.css" />
    <link rel="stylesheet" type="text/css" href="css/icons.css" />
    
    <!-- this page specific styles -->
    <link rel="stylesheet" href="css/compiled/new-user.css" type="text/css" media="screen" />
</head>
<body>
	<!-- main container -->
	<div class="content container-fluid">
		<!-- BreadcrumbNavigation -->
        <div class="row-fluid head">
            <div class="span12">
                <h4><fmt:message key="i18n.userCenter"/> &gt; 修改手机号码</h4>
            </div>
        </div>
        <!-- End BreadcrumbNavigation -->
        
        <div class="container-fluid">
            <div id="pad-wrapper" class="new-user">

                <div class="row-fluid form-wrapper">
                    <!-- left column -->
                    <div class="span9 with-sidebar">
                        <div class="container">
                        	<br>
                            <form id="updateInfo_form" action="registerUser!changeMobile.action" method="post" onsubmit="return changeBasicInfo();">
						    	<input type="hidden" name="rubDTO.loginName" value="${rubDTO.loginName }" />
       							<!-- <input type="hidden" id="pi_loginUser_authCodeType" name="rubDTO.authCodeType"/> -->
       							<input type="hidden"  name="pageUrl" value="changeMobile.jsp" />
                                <div class="span12 field-box">
                                    <label><fmt:message key="i18n.loginName"/>:</label>
                                    <input type="text" class="span9" readonly="readonly" value="${rubDTO.loginName }" />
                                </div>
                                <div class="span12 field-box">
                                    <label>原手机号码:</label>
                                    <input type="hidden" id="cp_loginUserMobile" name="rubDTO.mobile" value="${rubDTO.mobile}" />
									<input class="span9" readonly="readonly" value="${rubDTO.mobile}" />
                                </div>
                                <div class="span12 field-box">
                                    <label>原手机验证码：</label>
                                    <input class="ctrRBox2" id="cp_oldAuthCode" name="rubDTO.oldAuthCode"  style="margin-right: 6px;width: 100px;" >
									<input type="button" id="oldAuthCode_button" class="ctrR1Box4" onclick="getVerificationCode('Mobile','ChangeMobile','#cp_loginUserMobile','#oldAuthCode_button')"
										value="<fmt:message key="i18n.getVerificationCode"/>" 
										style="margin: 13px 0 0 0;height: 28px;line-height: 28px;" /> 
                                </div>
                                
                                <div class="span12 field-box">
                                    <label>新手机号码：</label>
									<input class="span9"  name="rubDTO.newMobile" id="cp_loginUserMobile_new"/>
                                </div>
                                
                                <div class="span12 field-box">
                                    <label>手机验证码:</label>
                                    <input type="text" class="span9" id="cp_validCode" name="rubDTO.authCode"  style="margin-right: 6px;width: 100px;" >
									<input type="button" class="ctrR1Box4" id="cp_loginName_button" 
										value="<fmt:message key="i18n.getVerificationCode"/>" 
										style="margin: 13px 0 0 0;height: 28px;line-height: 28px;" /> 
									<input type="hidden" value="${session.email }" id="cp_loginName"/>
                                </div>
                                <div class="span11 field-box">
                                	<c:if test="${not empty session.activationTime}">
									<input type="submit" class=tx_contBoxRAn value="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<fmt:message key="i18n.update"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" />
									</c:if>
									<c:if test="${empty session.activationTime}">
										<fmt:message key="tip.activeTip" />
									</c:if>
                                </div>
                            </form>
                        </div>
                    </div>

                </div>
            </div>
        </div>
        
    </div>    

	<script type="text/javascript" src="../scripts/jquery-1.11.0.min.js"></script>
	<script type="text/javascript" src="../scripts/user/common.js"></script>
	<script type="text/javascript">
	
	function changeBasicInfo(){
		if($('#cp_oldAuthCode').val()==''){
			alert('原手机验证码不允许为空!');
			$('#cp_oldAuthCode').focus();
			return false;
		}
		
		if($('#cp_loginUserMobile_new').val()==''){
			alert('新手机号码不允许为空');
			$('#cp_loginUserMobile_new').focus();
			return false;
		}
		
		if($('#cp_validCode').val()==''){
			alert('新手机验证码不允许为空!');
			$('#cp_validCode').focus();
			return false;
		}
		
		if($('#cp_loginUserMobile').val()==$('#cp_loginUserMobile_new').val()){
			alert('新手机与原手机一样!');
			$('#cp_logincp_loginUser').focus();
			return false;
		}
		
	}
	
	$(function(){
		document.onkeydown = function(evt){
			var evt = window.event?window.event:evt;
			if(evt.keyCode==13){
				changeBasicInfo();
			}
		}
	});
	</script>

				
</body>
</html>